package 力扣日常刷题.木23一月.第14天314;

/**
 * @author 帅小伙
 * @date 2022/3/14
 * @description
 */
public class Demo69把数字翻译成字符串{

    public int translateNum(int num) {
        String src = String.valueOf(num);
        int[] dp = new int[src.length()+1];
        dp[0] = 1;

        for (int i = 0; i < src.length(); i++) {
            dp[i+1] += dp[i];
            if(i == 0) continue;
            String pre = src.substring(i - 1, i + 1);
            if(pre.compareTo("25") <= 0 && pre.compareTo("10")>= 0)dp[i+1] += dp[i - 1];
        }
        return dp[src.length()];
    }
}
